>>> ['a', 'b', 'c'] !! 0 'a' >>> ['a', 'b', 'c'] !! 2 'c' >>> ['a', 'b', 'c'] !! 3 *** Exception: Prelude.!!: index too large >>> ['a', 'b', 'c'] !! (-1) *** Exception: Prelude.!!: negative indexWARNING: This function is partial. You can use atMay instead.
>>> ['a', 'b', 'c'] !! 0 'a' >>> ['a', 'b', 'c'] !! 2 'c' >>> ['a', 'b', 'c'] !! 3 *** Exception: Prelude.!!: index too large >>> ['a', 'b', 'c'] !! (-1) *** Exception: Prelude.!!: negative index
>>> ['a', 'b', 'c'] !! 0 'a' >>> ['a', 'b', 'c'] !! 2 'c' >>> ['a', 'b', 'c'] !! 3 Exception: Prelude.!!: index too large >>> ['a', 'b', 'c'] !! (-1) Exception: Prelude.!!: negative index
>>> map ((!!!) [1,3,5]) [0,1,2,3,4,5] [1,3,5,1,3,5]
>>> at 2 ["a", "b", "c"] "c"it is also useful when used in a partially applied position like:
>>> map (at 1) [["a","b","c"], ["a","b","c"], ["a","b","c"]] ["b","b","b"]